From: Keir Fraser Date: Wed, 22 Oct 2008 14:06:01 +0000 (+0100) Subject: Define spin_barrier_irq() for IRQ-safe spinlocks, and use it for virq_lock. X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~14054^2~53 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https://%22%22/%22http:/www.example.com/cgi/%22https:/%22%22?a=commitdiff_plain;h=828dfa9ef2bb3dae3ee29cccbe3d4d75bf56b8a6;p=xen.git Define spin_barrier_irq() for IRQ-safe spinlocks, and use it for virq_lock. Signed-off-by: Keir Fraser --- diff --git a/xen/common/event_channel.c b/xen/common/event_channel.c index 8e3e0d1f64..3993df4bc5 100644 --- a/xen/common/event_channel.c +++ b/xen/common/event_channel.c @@ -386,7 +386,7 @@ static long __evtchn_close(struct domain *d1, int port1) if ( v->virq_to_evtchn[chn1->u.virq] != port1 ) continue; v->virq_to_evtchn[chn1->u.virq] = 0; - spin_barrier(&v->virq_lock); + spin_barrier_irq(&v->virq_lock); } break; diff --git a/xen/common/spinlock.c b/xen/common/spinlock.c index 15420ebfe7..125e12d1bf 100644 --- a/xen/common/spinlock.c +++ b/xen/common/spinlock.c @@ -54,6 +54,14 @@ void _spin_barrier(spinlock_t *lock) mb(); } +void _spin_barrier_irq(spinlock_t *lock) +{ + unsigned long flags; + local_irq_save(flags); + _spin_barrier(lock); + local_irq_restore(flags); +} + void _spin_lock_recursive(spinlock_t *lock) { int cpu = smp_processor_id(); diff --git a/xen/include/xen/spinlock.h b/xen/include/xen/spinlock.h index 289018fea0..c49be63c5f 100644 --- a/xen/include/xen/spinlock.h +++ b/xen/include/xen/spinlock.h @@ -34,6 +34,7 @@ void _spin_unlock_irqrestore(spinlock_t *lock, unsigned long flags); int _spin_is_locked(spinlock_t *lock); int _spin_trylock(spinlock_t *lock); void _spin_barrier(spinlock_t *lock); +void _spin_barrier_irq(spinlock_t *lock); void _spin_lock_recursive(spinlock_t *lock); void _spin_unlock_recursive(spinlock_t *lock); @@ -67,6 +68,7 @@ void _write_unlock_irqrestore(rwlock_t *lock, unsigned long flags); /* Ensure a lock is quiescent between two critical operations. */ #define spin_barrier(l) _spin_barrier(l) +#define spin_barrier_irq(l) _spin_barrier_irq(l) /* * spin_[un]lock_recursive(): Use these forms when the lock can (safely!) be